import { _decorator, Component, Node } from 'cc';
import { UIExitAnimtions } from '../../Init/Tools/UIExitAnimations';
import EventManager from '../../Init/Managers/EventManager';
import { EventTypes } from '../../Init/Managers/EventTypes';
const { ccclass, property } = _decorator;

@ccclass('PopTip')
export class PopTip extends Component {

    @property(Node)
    bg: Node = null;
    @property(Node)
    panel: Node = null;

    protected onEnable(): void {
        EventManager.emit(EventTypes.CurLevelEvents.PauseLv);
    }
    protected onDisable(): void {
        EventManager.emit(EventTypes.CurLevelEvents.ResumeLv);
    }

    show() {
        this.node.active = true;
    }
    hide() {
        this.bg.getComponent(UIExitAnimtions).showHideAnim(false);
        this.panel.getComponent(UIExitAnimtions).showHideAnim(false, () => {
            this.node.active = false;
        }, true);
    }
    protected update(dt: number): void {
        EventManager.emit(EventTypes.CurLevelEvents.PauseLv);
    }

}


